xlv.obj.pane={
	extend: function(){
	},
	implement:function(){
		this.implement('xlv.imp.mvc');
		this.implement('xlv.imp.dmc');
	},
	create:function(tag){
		var div=document.createElement((tag||'div'));
		div.setAttribute('xlvobject','xlv.obj.pane');
		Element.addClassName(div,'class_pane');
		return div;
	},
	properties:{
		glow:{enable:false,hover:false,width:null,png:null},
		border:{enable:false,borderColor:null,background:null,style:'all'},
		bkOpacity:false
	},
	method:{
		construct:function(){
			Element.addClassName(this,'class_pane');
			if(this.$P.glow.hover) Element.addClassName(this,'glow_hover');
			var v=this.$V,p=this.$P;
			v.root=xlv.util.findChild(this,{id:'xlvid_pane_root'});
			if(!v.root) {
				v.root=document.createElement('div');
				v.root.setAttribute('id','xlvid_pane_root');
				while(this.firstChild) v.root.appendChild(this.firstChild);
				this.appendChild(v.root);
				this.styleFor(v.root);
			}
			if(p.glow.enable && this.style.background){
				v.root.style.background=this.style.background;
				this.style.background='';
			}
			this.$V.glowOption=Object.extend({},this.$P.glow);
			this.$V.borderOption=Object.extend({},this.$P.border);
			if(p.glow.enable) this.setGlow(p.glow);
			if(p.border.enable) {
				if(this.objectName()=='xlv.obj.frame'&&!p.border.background) p.border.background='none';
				this.setBorder(p.border);
			}
			if(p.bkOpacity) Element.addClassName(this,'bkOpacity');
		},
		styleFor:function(root){
		},
		initial:function(){
		},
		dispose:function(){
			setTimeout((function(){Event.fire(this,'xlv:dispose',xlv.sys.createMemoObject({type:'dispose',src:this}));}).bind(this),1);
		},
		getRootPane:function(){
			return this.$V.root;
		},
		_dmReady:function(){//call from sys.initialize
		},
		hasGlow:function(){
			return this.targetElement(this.$V.root,{id:'xlvid_glow_content'})? true :false;
		},
		hasBorder:function(){
			return this.targetElement(this.$V.root,{id:'xlvid_border_content'})? true :false;
		},
		setGlow:function(option){
			option=Object.extend(this.$V.glowOption,option);
			this.$V.glowOption=option;
			if(!option.enable){
				this.removeGlow();
				return;
			}
			var g1,c1,c2,g2,g3,content;
			if(!this.hasGlow()){
				content=document.createElement('div');
				content.setAttribute('id','xlvid_glow_content');
				if(this.hasBorder()){
					var bcp=this.targetElement(this.$V.root,{id:'xlvid_border_content'}).parentNode;
					while(bcp.firstChild)content.appendChild(bcp.firstChild);
				}else content.appendChild(this.$V.root);
				this.appendChild(g1=document.createElement('div'));
				g1.setAttribute('id','xlvid_glow_g1');
				g1.appendChild(c1=document.createElement('div'));
				c1.setAttribute('id','xlvid_glow_c1');
				g1.appendChild(c2=document.createElement('div'));
				c2.setAttribute('id','xlvid_glow_c2');
				g1.appendChild(g2=document.createElement('div'));
				g2.setAttribute('id','xlvid_glow_g2');
				g2.appendChild(g3=document.createElement('div'));
				g3.setAttribute('id','xlvid_glow_g3');
				g3.appendChild(content);
			}else{
				g1=this.targetElement(this.$V.root,{id:'xlvid_glow_g1'});
				g2=this.targetElement(this.$V.root,{id:'xlvid_glow_g2'});
				g3=this.targetElement(this.$V.root,{id:'xlvid_glow_g3'});
				content=this.targetElement(this.$V.root,{id:'xlvid_glow_content'});
				c1=xlv.util.findDirectChild(g1,{id:'xlvid_glow_c1'});
				c2=xlv.util.findDirectChild(g1,{id:'xlvid_glow_c2'});
			}
			if(option.png){
				var image='url(/xlive/images/'+option.png+')';
				c1.style.backgroundImage=image;
				c2.style.backgroundImage=image;
				g2.style.backgroundImage=image;
				g3.style.backgroundImage=image;
			}
			if(option.width&&option.width>0){
				var w=option.width;
				g1.style.paddingTop=(2*w)+'px';
				g1.style.paddingLeft=(2*w)+'px';
				c1.style.width=(2*w)+'px';
				c1.style.height=(2*w)+'px';
				c2.style.width=(2*w)+'px';
				c2.style.height=(2*w)+'px';
				g3.style.left=(-2*w)+'px';
				g3.style.top=(-2*w)+'px';
				content.style.top=w+'px';
				content.style.left=w+'px';
			}
			this.styleForGlow(g1,'xlvid_glow_g1');
			this.styleForGlow(c1,'xlvid_glow_c1');
			this.styleForGlow(c2,'xlvid_glow_c2');
			this.styleForGlow(g2,'xlvid_glow_g2');
			this.styleForGlow(g3,'xlvid_glow_g3');
			this.styleForGlow(content,'xlvid_glow_content');
		},
		styleForGlow:function(glow,id){
		},
		removeGlow:function(){
			var g1=this.targetElement(this.$V.root,{id:'xlvid_glow_g1'});
			var content=this.targetElement(this.$V.root,{id:'xlvid_glow_content'});
			if(content&&g1) {
				while(content.firstChild)this.appendChild(content.firstChild);
				g1.parentNode.removeChild(g1);
			}
		},
		setBorder:function(option){
			option=Object.extend(this.$V.borderOption,option);
			this.$V.borderOption=option;
			if(!option.enable){
				this.removeBorder();
				return;
			}
			var b1,b2,b3,b4,b1b,b2b,b3b,b4b,content;
			var rootp=this.$V.root.parentNode;
			if(!this.hasBorder()){
				rootp.appendChild(b1=document.createElement('b'));
				b1.setAttribute('id','xlvid_border_b1');
				rootp.appendChild(b2=document.createElement('b'));
				b2.setAttribute('id','xlvid_border_b2');
				rootp.appendChild(b3=document.createElement('b'));
				b3.setAttribute('id','xlvid_border_b3');
				rootp.appendChild(b4=document.createElement('b'));
				b4.setAttribute('id','xlvid_border_b4');
				rootp.appendChild(content=document.createElement('div'));
				content.setAttribute('id','xlvid_border_content');
				content.appendChild(this.$V.root);
				rootp.appendChild(b4b=document.createElement('b'));
				b4b.setAttribute('id','xlvid_border_b4b');
				rootp.appendChild(b3b=document.createElement('b'));
				b3b.setAttribute('id','xlvid_border_b3b');
				rootp.appendChild(b2b=document.createElement('b'));
				b2b.setAttribute('id','xlvid_border_b2b');
				rootp.appendChild(b1b=document.createElement('b'));
				b1b.setAttribute('id','xlvid_border_b1b');
			}else{
				content=this.targetElement(this.$V.root,{id:'xlvid_border_content'});
				var bs=xlv.util.siblings(content);
				for(i=0;i<bs.length;++i){
					if(bs[i].id=='xlvid_border_b1') b1=bs[i];
					if(bs[i].id=='xlvid_border_b2') b2=bs[i];
					if(bs[i].id=='xlvid_border_b3') b3=bs[i];
					if(bs[i].id=='xlvid_border_b4') b4=bs[i];
					if(bs[i].id=='xlvid_border_b1b') b1b=bs[i];
					if(bs[i].id=='xlvid_border_b2b') b2b=bs[i];
					if(bs[i].id=='xlvid_border_b3b') b3b=bs[i];
					if(bs[i].id=='xlvid_border_b4b') b4b=bs[i];
				}
			}
			var bk=(!option.background)?this.$V.root.style.background:option.background;
			if(bk && bk!='none'){
				b2.style.background=bk;
				b3.style.background=bk;
				b4.style.background=bk;
				b4b.style.background=bk;
				b3b.style.background=bk;
				b2b.style.background=bk;
			}
			var bcolor=option.borderColor;
			if(bcolor){
				b1.style.backgroundColor=bcolor;
				b2.style.borderLeftColor=b2.style.borderRightColor=bcolor;
				b3.style.borderLeftColor=b3.style.borderRightColor=bcolor;
				b4.style.borderLeftColor=b4.style.borderRightColor=bcolor;
				content.style.borderLeftColor=content.style.borderRightColor=bcolor;
				content.style.borderTopColor=content.style.borderBottomColor=bcolor;
				b4b.style.borderLeftColor=b4b.style.borderRightColor=bcolor;
				b3b.style.borderLeftColor=b3b.style.borderRightColor=bcolor;
				b2b.style.borderLeftColor=b2b.style.borderRightColor=bcolor;
				b1b.style.backgroundColor=bcolor;
			}
			Element.removeClassName(this,'border_top');
			Element.removeClassName(this,'border_bottom');
			if(option.style=='top')Element.addClassName(this,'border_top');
			if(option.style=='bottom')Element.addClassName(this,'border_bottom');
			this.styleForBorder(b1,'xlvid_border_b1');
			this.styleForBorder(b2,'xlvid_border_b2');
			this.styleForBorder(b3,'xlvid_border_b3');
			this.styleForBorder(b4,'xlvid_border_b4');
			this.styleForBorder(content,'xlvid_border_content');
			this.styleForBorder(b4b,'xlvid_border_b4b');
			this.styleForBorder(b3b,'xlvid_border_b3b');
			this.styleForBorder(b2b,'xlvid_border_b2b');
			this.styleForBorder(b1b,'xlvid_border_b1b');
		},
		styleForBorder:function(border,id){
		},
		removeBorder:function(){
			var content=this.targetElement(this.$V.root,{id:'xlvid_border_content'});
			if(content){
				if(this.hasGlow()){
					var gc=this.targetElement(this.$V.root,{id:'xlvid_glow_content'});
					gc.appendChild(this.$V.root);
				}else this.appendChild(this.$V.root);
				var cp=content.parentNode;
				while(cp.firstChild)cp.removeChild(cp.firstChild);
			}
		}
	}
};


